<#import "base.ftl" as base/>
<#import "spring.ftl" as spring/>

<@base.baseTemplate title="computerlist">
	<div class="line">
		<div class="unit right">
			<label><@spring.message "scan"/>:</label>
			<select id="scanselector" name="scanid">
				<#list scan_list as scan>
					<#if scan.id! == selectedScan.id!>
			  			<option value="${scan.id}" selected="selected">${scan.startTimeStamp}</option>
					<#else>
						<option value="${scan.id}">${scan.startTimeStamp}</option>
					</#if>
				</#list>
			</select>
		</div>
	</div>
	<#if (scanresult_list?size > 0)>
		<div class="line">
			<table class="ui-widget">
				<thead class="ui-widget-header">
					<tr>
				  		<th><@spring.message "computerName"/></th>
				  		<th><@spring.message "ipAddress"/></th>
				  		<th><@spring.message "type"/></th>
				  		<th><@spring.message "cpuType"/></th>
				  		<th><@spring.message "operatingSystem"/></th>
				  	</tr>
				</thead>
				<tbody class="ui-widget-content">
				  	<#list scanresult_list as scanresult>
				  		<tr>
						  	<td><a href="${rc.getContextPath()}/scan/${scanresult.id}">${scanresult.computerName!}</a></td>
							<td>${scanresult.scanIpAddress!}</td>
							<td><@spring.message "pctype.${scanresult.computerType!}"/></td>
							<td>${scanresult.cpu!}</td>
						  	<td>${scanresult.operatingSystem!}</td>
				  		</tr>
					</#list>
				</tbody>
			</table>
		</div>
	</#if>
	<script type="text/javascript">
        $(function () {
            $("#scanselector").live("change keyup", function () {
                var url = document.location.href;
                document.location.href = url.substring(0, url.lastIndexOf('/')) + '/' + $("#scanselector").val(); 
            });
        });
    </script>
</@base.baseTemplate>